The ARG_PRESENT function is useful in user-written procedures that need to know if the lifetime of a value they are creating extends beyond the current routine’s lifetime. This can be important for two reasons:
Suppose that you are writing an IDL procedure that has the following procedure definition line:
PRO myproc, RET_PTR = ret_ptr
The intent of the RET_PTR keyword is to pass back a pointer to a new pointer heap variable. The following command could be used to avoid creating (and possibly losing) a pointer if no named variable is provided by the caller:
IF ARG_PRESENT(ret_ptr) THEN BEGIN
The commands that follow would only be executed if ret_ptr is supplied and will be copied into a variable in the scope of the calling routine.
Result = ARG_PRESENT(Variable)
Returns a nonzero value if the following conditions are met:
In other words, ARG_PRESENT returns TRUE if the value of the specified variable will be passed back to the caller.
The variable to be tested.
|
5.0 |
Introduced |